<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Locating Standard Directories</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
<link rel="home" href="index.html" title="GnomeVFS - Filesystem Abstraction library">
<link rel="up" href="gnome-vfs-directory-ops.html" title="Directory-Specific Operations">
<link rel="prev" href="gnome-vfs-2.0-gnome-vfs-directory-list-ops.html" title="Listing Directory Contents">
<link rel="next" href="gnome-vfs-file-and-dirs-ops.html" title="Advanced File/Directory Operations">
<meta name="generator" content="GTK-Doc V1.15.1 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
<tr valign="middle">
<td><a accesskey="p" href="gnome-vfs-2.0-gnome-vfs-directory-list-ops.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
<td><a accesskey="u" href="gnome-vfs-directory-ops.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
<th width="100%" align="center">GnomeVFS - Filesystem Abstraction library</th>
<td><a accesskey="n" href="gnome-vfs-file-and-dirs-ops.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
</tr>
<tr><td colspan="5" class="shortcuts">
<a href="#gnome-vfs-2.0-gnome-vfs-directory-find-ops.synopsis" class="shortcut">Top</a>
                   | 
                  <a href="#gnome-vfs-2.0-gnome-vfs-directory-find-ops.description" class="shortcut">Description</a>
</td></tr>
</table>
<div class="refentry">
<a name="gnome-vfs-2.0-gnome-vfs-directory-find-ops"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2><span class="refentrytitle"><a name="gnome-vfs-2.0-gnome-vfs-directory-find-ops.top_of_page"></a>Locating Standard Directories</span></h2>
<p>Locating Standard Directories — Utilities for locating standard directories such as the desktop and trash</p>
</td>
<td valign="top" align="right"></td>
</tr></table></div>
<div class="refsynopsisdiv">
<a name="gnome-vfs-2.0-gnome-vfs-directory-find-ops.synopsis"></a><h2>Synopsis</h2>
<pre class="synopsis">enum                <a class="link" href="gnome-vfs-2.0-gnome-vfs-directory-find-ops.html#GnomeVFSFindDirectoryKind" title="enum GnomeVFSFindDirectoryKind">GnomeVFSFindDirectoryKind</a>;
<a class="link" href="gnome-vfs-2.0-gnome-vfs-result.html#GnomeVFSResult" title="enum GnomeVFSResult"><span class="returnvalue">GnomeVFSResult</span></a>      <a class="link" href="gnome-vfs-2.0-gnome-vfs-directory-find-ops.html#gnome-vfs-find-directory" title="gnome_vfs_find_directory ()">gnome_vfs_find_directory</a>            (<em class="parameter"><code><a class="link" href="gnome-vfs-2.0-gnome-vfs-uri.html#GnomeVFSURI" title="GnomeVFSURI"><span class="type">GnomeVFSURI</span></a> *near_uri</code></em>,
                                                         <em class="parameter"><code><a class="link" href="gnome-vfs-2.0-gnome-vfs-directory-find-ops.html#GnomeVFSFindDirectoryKind" title="enum GnomeVFSFindDirectoryKind"><span class="type">GnomeVFSFindDirectoryKind</span></a> kind</code></em>,
                                                         <em class="parameter"><code><a class="link" href="gnome-vfs-2.0-gnome-vfs-uri.html#GnomeVFSURI" title="GnomeVFSURI"><span class="type">GnomeVFSURI</span></a> **result</code></em>,
                                                         <em class="parameter"><code><span class="type">gboolean</span> create_if_needed</code></em>,
                                                         <em class="parameter"><code><span class="type">gboolean</span> find_if_needed</code></em>,
                                                         <em class="parameter"><code><span class="type">guint</span> permissions</code></em>);
</pre>
</div>
<div class="refsect1">
<a name="gnome-vfs-2.0-gnome-vfs-directory-find-ops.description"></a><h2>Description</h2>
<p>
</p>
</div>
<div class="refsect1">
<a name="gnome-vfs-2.0-gnome-vfs-directory-find-ops.details"></a><h2>Details</h2>
<div class="refsect2">
<a name="GnomeVFSFindDirectoryKind"></a><h3>enum GnomeVFSFindDirectoryKind</h3>
<pre class="programlisting">typedef enum {
	GNOME_VFS_DIRECTORY_KIND_DESKTOP = 1000,
	GNOME_VFS_DIRECTORY_KIND_TRASH = 1001
} GnomeVFSFindDirectoryKind;
</pre>
<p>
Specifies what directory <a class="link" href="gnome-vfs-2.0-gnome-vfs-directory-find-ops.html#gnome-vfs-find-directory" title="gnome_vfs_find_directory ()"><code class="function">gnome_vfs_find_directory()</code></a> or
<code class="function">gnome_vfs_find_directory_cancellable()</code> should find.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><a name="GNOME-VFS-DIRECTORY-KIND-DESKTOP:CAPS"></a><span class="term"><code class="literal">GNOME_VFS_DIRECTORY_KIND_DESKTOP</code></span></p></td>
<td>Desktop directory.
</td>
</tr>
<tr>
<td><p><a name="GNOME-VFS-DIRECTORY-KIND-TRASH:CAPS"></a><span class="term"><code class="literal">GNOME_VFS_DIRECTORY_KIND_TRASH</code></span></p></td>
<td>Trash directory.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="gnome-vfs-find-directory"></a><h3>gnome_vfs_find_directory ()</h3>
<pre class="programlisting"><a class="link" href="gnome-vfs-2.0-gnome-vfs-result.html#GnomeVFSResult" title="enum GnomeVFSResult"><span class="returnvalue">GnomeVFSResult</span></a>      gnome_vfs_find_directory            (<em class="parameter"><code><a class="link" href="gnome-vfs-2.0-gnome-vfs-uri.html#GnomeVFSURI" title="GnomeVFSURI"><span class="type">GnomeVFSURI</span></a> *near_uri</code></em>,
                                                         <em class="parameter"><code><a class="link" href="gnome-vfs-2.0-gnome-vfs-directory-find-ops.html#GnomeVFSFindDirectoryKind" title="enum GnomeVFSFindDirectoryKind"><span class="type">GnomeVFSFindDirectoryKind</span></a> kind</code></em>,
                                                         <em class="parameter"><code><a class="link" href="gnome-vfs-2.0-gnome-vfs-uri.html#GnomeVFSURI" title="GnomeVFSURI"><span class="type">GnomeVFSURI</span></a> **result</code></em>,
                                                         <em class="parameter"><code><span class="type">gboolean</span> create_if_needed</code></em>,
                                                         <em class="parameter"><code><span class="type">gboolean</span> find_if_needed</code></em>,
                                                         <em class="parameter"><code><span class="type">guint</span> permissions</code></em>);</pre>
<p>
Used to return well known directories such as Trash, Desktop, etc. from different
file systems.
</p>
<p>
There is quite a complicated logic behind finding/creating a Trash directory
and you need to be aware of some implications:
Finding the Trash the first time when using the file method may be pretty 
expensive. A cache file is used to store the location of that Trash file
for next time.
If <em class="parameter"><code>create_if_needed</code></em> is specified without <em class="parameter"><code>find_if_needed</code></em>, you may end up
creating a Trash file when there already is one. Your app should start out
by doing a <a class="link" href="gnome-vfs-2.0-gnome-vfs-directory-find-ops.html#gnome-vfs-find-directory" title="gnome_vfs_find_directory ()"><code class="function">gnome_vfs_find_directory()</code></a> with the <em class="parameter"><code>find_if_needed</code></em> to avoid this
and then use the <em class="parameter"><code>create_if_needed</code></em> flag to create Trash lazily when it is
needed for throwing away an item on a given disk.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>near_uri</code></em> :</span></p></td>
<td>find a well known directory on the same volume as <em class="parameter"><code>near_uri</code></em>.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>kind</code></em> :</span></p></td>
<td>kind of well known directory.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>result</code></em> :</span></p></td>
<td>newly created uri of the directory we found.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>create_if_needed</code></em> :</span></p></td>
<td>if directory we are looking for does not exist, try to create it.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>find_if_needed</code></em> :</span></p></td>
<td>if we don't know where directory is yet, look for it.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>permissions</code></em> :</span></p></td>
<td>if creating, use these permissions.
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> an integer representing the result of the operation.
</td>
</tr>
</tbody>
</table></div>
</div>
</div>
</div>
<div class="footer">
<hr>
          Generated by GTK-Doc V1.15.1</div>
</body>
</html>